{extend name="layout/layout" /}

{block name="content"}
<div class="row">
    <div class="col-md-12">
        <div class="portlet light">
            <div class="portlet-title">
                <div class="caption">
                    <i class="icon-share font-dark"></i>
                    <span class="caption-subject font-dark bold uppercase"> 添加扶贫项目</span>
                </div>
                <div class="actions">
                    <a class="btn btn-circle btn-icon-only btn-default fullscreen" href="javascript:;" data-original-title="" title=""> </a>
                </div>
            </div>
            <div class="portlet-body">
                <form class="form-horizontal form" id="povertywork_form" action="{:url('admin/'.strtolower($model).'/addpost')}" method="post" id="add_new">
                    <div class="form-body">
                        <div class="row" style="margin-bottom: 10px;">
                            <div class="col-md-9">
                                <div class="form-inline">
                                    <label class="control-label col-md-3">
                                        选择乡村
                                        <span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <p class="form-control-static">{$area}</p>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        贫困户<span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <p class="form-control-static">{$info.member.name}</p>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        项目标题<span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <input type="text" class="form-control" maxlength="100" name="title" value="{$info.title}">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        封面图
                                    </label>
                                    <div class="col-md-9">
                                        <div id="upload-image">
                                            <span id="upload-btn" data-multi="false">
                                                <input type="hidden" class="form-control" id="coverImg" data-required="1" name="coverImg" value="{$info.imgUrl}">
                                                <img src="{$info.imgUrl|default='__STATIC__/admin/img/default.png'}" alt="图片上传" style="width: 100px;height: 100px;" />
                                            </span>
                                        </div>
                                        <span class="help-block"> (建议尺寸：690*460) </span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        分类<span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <select class="form-control" name="typeId">
                                            <option value="0">请选择</option>
                                            {volist name="typeList" id="vo"}
                                            <option value="{$vo.id}" {eq name="vo.id" value="$info.typeId"} selected {/eq} >{$vo.name}</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        扶贫方式
                                    </label>
                                    <div class="col-md-9 istype">
                                        <p class="form-control-static">{if condition="($info['type'] == 1)"} 捐物品 {else /} 捐款 {/if} </p>
                                        <input type="hidden" name="type" value="{$info.type}">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="type1">
                            <div class="row">
                                <div class="col-md-9">
                                    <div class="form-group">
                                        <label class="control-label col-md-3">
                                            物品名称<span class="required">*</span>
                                        </label>
                                        <div class="col-md-9">
                                            <input type="text" class="form-control" maxlength="50" name="productName" value="{$info.productName}">
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-9">
                                    <div class="form-group">
                                        <label class="control-label col-md-3">
                                           物品数量<span class="required">*</span>
                                        </label>
                                        <div class="col-md-9">
                                            <input type="text" class="form-control" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" maxlength="4" name="productNum" value="{$info.productNum}">
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-9">
                                    <div class="form-group">
                                        <label class="control-label col-md-3">
                                            收件人<span class="required">*</span>
                                        </label>
                                        <div class="col-md-9">
                                            <input type="text" class="form-control" name="receiveName" value="{$info.receiveName}" maxlength="10" >
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-9">
                                    <div class="form-group">
                                        <label class="control-label col-md-3">
                                            收件地址<span class="required">*</span>
                                        </label>
                                        <div class="col-md-9">
                                            <input type="text" class="form-control" name="receiveAddress" value="{$info.receiveAddress}" maxlength="100" >
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-9">
                                    <div class="form-group">
                                        <label class="control-label col-md-3">
                                            邮政编码<span class="required">*</span>
                                        </label>
                                        <div class="col-md-9">
                                            <input type="text" class="form-control" name="zipCode" value="{$info.zipCode}" maxlength="10" >
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="type2 hide">
                            <div class="row">
                                <div class="col-md-9">
                                    <div class="form-group">
                                        <label class="control-label col-md-3">
                                            捐款金额<span class="required">*</span>
                                        </label>
                                        <div class="col-md-9">
                                            <input type="number" class="form-control" name="money" value="{$info.money/100}">
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-9">
                                    <div class="form-group">
                                        <label class="control-label col-md-3">
                                           收款人<span class="required">*</span>
                                        </label>
                                        <div class="col-md-9">
                                            <input type="text" class="form-control"   name="accountName" value="{$info.accountName}">
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-9">
                                    <div class="form-group">
                                        <label class="control-label col-md-3">
                                            账户银行<span class="required">*</span>
                                        </label>
                                        <div class="col-md-9">
                                            <input type="text" class="form-control" name="bankName" value="{$info.bankName}" maxlength="10" >
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-9">
                                    <div class="form-group">
                                        <label class="control-label col-md-3">
                                            银行卡号<span class="required">*</span>
                                        </label>
                                        <div class="col-md-9">
                                            <input type="text" class="form-control" name="bankCode" value="{$info.bankCode}" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" maxlength="19" >
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        项目描述<span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <textarea class="form-control" id="note" onkeyup="this.value=this.value.substring(0,800)" data-required="1" maxlength="800"  rows="3" cols="20" name="content">{$info.content}</textarea><span id="text-count" value="{$info.content}">0</span>/800
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        图片
                                    </label>
                                    <div class="col-md-9">
                                        <div id="cover-image">
                                            {volist name="imgList" id="vo"}
                                            <span class="multi-image">
                                                <input type="hidden" name="imgIds" value="{$vo.id}">
                                                <input type="hidden" name="imgUrl" value="{$vo.imgUrl}">
                                                <img class="exist-image" src="{$vo.imgUrl}" alt="">
                                                <img class="del" src="__STATIC__/pages/image/del.png" alt="">
                                            </span>
                                            {/volist}
                                            <span id="upload-cover-btn" data-multi="true" data-ajax="true" data-field="imgUrl">
                                                <img src="__STATIC__/admin/img/default.png" alt="图片上传" style="width: 100px;height: 100px;" />
                                            </span>
                                        </div>
                                        <span class="help-block"> 最多上传6张 (建议尺寸：750*400) </span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <input type="hidden" name="id" value="{$info.id}">

                        <div class="form-actions">
                            <div class="row">
                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label class="col-md-3 control-label"></label>
                                        <div class="col-md-9">
                                            <button type="button" id="form-submit" class="btn btn-primary">
                                                保存 <i class="fa fa-floppy-o"></i>
                                            </button>
                                            <button type="button" class="btn btn-default" onclick="history.go(-1);">
                                                返回 <i class="fa fa-mail-forward"></i>
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<input type="hidden" class="token_url" value="{:url('admin/Image/token')}">
<input type="hidden" class="record_url" value="{:url('admin/Image/record')}">
<input type="hidden" class="delimage_url" value="{:url('admin/Image/delete')}">
{/block}

{block name="pagescript"}
<script src="__STATIC__/plugins/datatables/datatables.min.js" type="text/javascript"></script>
<script type="text/javascript">

    var posturl = "{:url('admin/'.strtolower($model).'/editpost')}";
    var povertymember = "{:url('admin/layer/povertymember')}";
    var imgcount = "{$imgcount}";
    var total = 6;
    
</script>
<script src="__STATIC__/admin/js/qiniu/plupload.full.min.js" type="text/javascript"></script>
<script src="__STATIC__/admin/js/qiniu/qiniu.js" type="text/javascript"></script>
<script src="__STATIC__/admin/js/qiniu/qiniuConfig.js" type="text/javascript"></script>
<script src="__STATIC__/admin/pages/js/povertyproject.js" type="text/javascript"></script>
<script src="__STATIC__/admin/pages/js/uploadfile.js" type="text/javascript"></script>
{/block}